<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<html>
<head>
<script src="${contextPath}/scripts/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="${contextPath}/scripts/common.js" type="text/javascript"></script>
<script src="${contextPath}/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<link href="${contextPath}/styles/default.css" rel="stylesheet" type="text/css" />
<title>发起流程审核</title>
<script type="text/javascript">
	function jumpPage(page) {
		var searchForm = document.searchForm;
		searchForm.action = "<s:property value='contextPath'/>/workflow/index.do?serachIndex=2&currentPage=" + page;
		searchForm.submit();
	}
	
	//审核
	function audit(objId,type){
		var searchForm = document.searchForm;
		//修改
		if(type==1){
			searchForm.action = "<s:property value='contextPath'/>/cm/update/workToExamine.do?id="+objId;
		}
		//释放
		if(type==2){
			searchForm.action = "<s:property value='contextPath'/>/cm/release/preAudit.do?currentPage=${currentPage}&flag=1&entity.id="+objId;
		}
		//补录
		else if(type==0){
			searchForm.action = "<s:property value='contextPath'/>/cm/verify.do?currentPage=${currentPage}&flag=1&id="+objId;
		}
		//二网
		else if(type==3){
			searchForm.action = "<s:property value='contextPath'/>/cs/ct/verify.do?currentPage=${currentPage}&flag=1&id="+objId;
		}else if(type == 4){
			searchForm.action = "<s:property value='contextPath'/>/cm/renew/preAudit.do?currentPage=${currentPage}&flag=1&entity.id=" + objId;
		}
		else if(type==5){
			searchForm.action = "<s:property value='contextPath'/>/cm/batchAdd/auditingApplyodd.do?id="+objId;
		}
		searchForm.submit();
	} 
	
	//查看详情
	function view(objId,type){
		var searchForm = document.searchForm;
		//修改
		if(type==1){
			searchForm.action = "<s:property value='contextPath'/>/cm/show.do?c.id="+objId;
		}
		//释放
		if(type==2){
			searchForm.action = "<s:property value='contextPath'/>/cm/release/view.do?entity.id="+objId;
		}
		//补录
		else if(type==0){
			searchForm.action = "<s:property value='contextPath'/>/cm/view.do?entity.id="+objId;
		}
		//二网
		else if(type==3){
			searchForm.action = "<s:property value='contextPath'/>/cs/ct/view.do?id="+objId;
		}
		else if(type==4){
			searchForm.action = "<s:property value='contextPath'/>/cm/renew/view.do?entity.id="+objId;
		}
		else if(type==5){
			searchForm.action = "<s:property value='contextPath'/>/cm/batchAdd/checkApplyodd.do?id="+objId;
		}
		searchForm.submit();
	} 
</script>
</head>
<body>
<div class="navigation">
  <span><a href="javascript:window.history.back();"><img src="${contextPath}/images/back_nav_btn.png" /></a>
  <a href="javascript:window.history.back();">返回</a>
  <a href="javascript:window.history.forward();"><img src="${contextPath}/images/go_nav_btn.png" /></a>
   <a href="javascript:window.history.forward();">前进</a>
  <a href="javascript:window.location.reload();"><img src="${contextPath}/images/refresh_nav_btn.png" /></a>
   <a href="javascript:window.location.reload();">刷新</a>
  </span>合格证管理&gt;&gt;流程管理
</div>

<div class="xt_main_right_center">    
<form name="searchForm" id="searchForm" method="post" action="index.do?serachIndex=2">
<table width="100%" border="0" cellpadding="0" cellspacing="0"  style="border-color:#CCCCCC;">
	<tr>
		<td class="left-td-width-bg" width="10%"><span>发起人:</span> </td>
       	<td width="30%">
			<input type="text" name='search.sponsor.realName'  class="input" value="<s:property value="search.sponsor.realName"/>"  style='width:120px'/>
		</td>
		<td class="left-td-width-bg" width="10%"><span>流程类型:</span> </td>
		<td colspan="3" width="50%">
           	<s:select name="type" list="@com.jysz.certificate.persistence.enums.WorkflowType@values()" theme="simple" listKey="index" listValue="name" headerKey="-1" headerValue="--请选择--" value="type"></s:select>
		</td>
	</tr>
	<tr>
		<td class="left-td-width-bg"><span>发起时间:</span></td>
		<td>
           	<input name="search.createdAt" id="sponsorDateBegin"  class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="search.createdAt" format="yyyy-MM-dd"/>"  onblur="checkdate(this,document.getElementById('sponsorDateEnd'))" />
           	至 <input name="search.updatedAt" id="sponsorDateEnd" class="Wdate" type="text" style="width: 100px" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="true" value="<s:date name="search.updatedAt" format="yyyy-MM-dd"/>"  onblur="checkdate(document.getElementById('sponsorDateBegin'),this)"/>
           </td>
           <td class="left-td-width-bg"><span>状态:</span></td>
           <td colspan="3"> 
<%--            	<s:select name="status" list="@com.jysz.certificate.persistence.enums.WorkflowState@values()" theme="simple" listKey="index" listValue="name" headerKey="-1" headerValue="--请选择--" value="status"></s:select> --%>
           	<select name="status">
           		<option value="-1">--请选择--</option>
           		<option <s:if test="status==1">selected="selected"</s:if> value="1" >待审核</option>
           		<option <s:if test="status==2">selected="selected"</s:if> value="2">已退回</option>
           		<option <s:if test="status==3">selected="selected"</s:if> value="3">已通过</option>
           		<option <s:if test="status==4">selected="selected"</s:if> value="4">已完成</option>
           	</select>
		</td>
	</tr>
	<tr style="background:url(${contextPath}/images/xt_main_right_dhbj.jpg) repeat-x;">
		<td colspan="6" align="right" style="padding-right: 120px">
			&nbsp;&nbsp;<input type="reset" class="btn_clear_form" value=" "/>
			&nbsp;&nbsp;<input id='sousuo' type="submit" value=" "  class="btn_query"/>
		</td>
	</tr>
</table>
</form>
</div> 
<br/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td height="25" align="left"><font color="#0066CC"><strong>流程列表：</strong></font></td>
		<td height="25" align="right"></td>
	</tr>
</table> 
      
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC">
	<tr> 
		<td width="4%" class="top-td-width-bg">序号</td>
		<td width="5%" class="top-td-width-bg">销售店</td>
		<td width="15%" class="top-td-width-bg">金融机构</td>
		<td width="5%" class="top-td-width-bg">数量</td>
	    <td width="15%" class="top-td-width-bg">发起人</td>
	    <td width="15%" class="top-td-width-bg">流程类型</td>
	    <td width="14%" class="top-td-width-bg">发起时间</td>
	    <td width="15%" class="top-td-width-bg">状态</td>
	    <td width="10%" class="top-td-width-bg">操作</td>
	</tr>
 	<s:iterator value="page.result" status="st">
		<tr>
			<td class="down-center-td-width-bg">
				<s:property value="#st.index+1"/>
			</td>
			
			<s:if test="@com.jysz.certificate.persistence.enums.WorkflowType@RELEASE.equals(type)">
			<s:set value="ShopNameMark(id)" name="releaseObj"></s:set>
			<td class="down-center-td-width-bg"><s:property value="#releaseObj.shop.shopName"/></td>
			<td class="down-center-td-width-bg"><s:property value="#releaseObj.financial.name"/></td>
			<td class="down-center-td-width-bg"><s:property value="#releaseObj.list.size()"/></td>
			</s:if>
			<s:elseif test="@com.jysz.certificate.persistence.enums.WorkflowType@ADD.equals(type)">
			<s:set value="certificationName(id)" name="certificationObj" ></s:set>
			<td class="down-center-td-width-bg"><s:property value="#certificationObj.shop.shopName"/></td>
			<td class="down-center-td-width-bg"><s:property value="#certificationObj.financial.name"/></td>
			<td class="down-center-td-width-bg"><s:property value="1"/></td>
			</s:elseif>
			<s:elseif test="@com.jysz.certificate.persistence.enums.WorkflowType@UPDATE.equals(type)">
			<s:set value="certificateName(id)" name="certificateObj" ></s:set>
			<td class="down-center-td-width-bg"><s:property value="#certificateObj.shop.shopName"/></td>
			<td class="down-center-td-width-bg"><s:property value="#certificateObj.financial.name"/></td>
			<td class="down-center-td-width-bg"><s:property value="1"/></td>
			</s:elseif>
			<s:elseif test="@com.jysz.certificate.persistence.enums.WorkflowType@SECOND.equals(type)">
			<s:set value="theNetworkName(id)" name="theNetworkObj" ></s:set>
			<td class="down-center-td-width-bg"><s:property value="#theNetworkObj.shop.shopName"/></td>
			<td class="down-center-td-width-bg"><s:property value="#theNetworkObj.financial.name"/></td>
			<td class="down-center-td-width-bg"><s:property value="#theNetworkObj.theNetworks.size()"/></td>
			</s:elseif>
			<s:elseif test="@com.jysz.certificate.persistence.enums.WorkflowType@RENEW.equals(type)">
			<s:set value="certificateRenewName(id)" name="certificateRenewObj" ></s:set>
			<td class="down-center-td-width-bg"><s:property value="#certificateRenewObj.shop.shopName"/></td>
			<td class="down-center-td-width-bg"><s:property value="#certificateRenewObj.financial.name"/></td>
			<td class="down-center-td-width-bg"><s:property value="#certificateRenewObj.outCertifications.size()"/></td>
			</s:elseif>
			<s:elseif test="@com.jysz.certificate.persistence.enums.WorkflowType@ADDLIST.equals(type)">
			<s:set value="applyCer(id)" name="applyCer" ></s:set>
			<td class="down-center-td-width-bg"><s:property value="#applyCer.shop.shopName"/></td>
			<td class="down-center-td-width-bg"></td>
			<td class="down-center-td-width-bg"><s:property value="#applyCer.applyCerLists.size()"/></td>
			</s:elseif>
			<td class="down-center-td-width-bg">
				<s:property value="sponsor.realName" />
			</td>
			<td class="down-center-td-width-bg">
				<s:property value="type.name" />
			</td>
			<td class="down-center-td-width-bg"><s:property value="createdAt" /></td>
			<td class="down-center-td-width-bg"><s:property value="state.name" />(<s:property value="type.name" />)</td>
			<td class="down-center-td-width-bg">
			<jysz:permission code="CM_WF_VEIW">
				<a href="javascript:view(<s:property value="getFirstObjId(id)"/>,<s:property value="type.index"/>);"><img src="${contextPath}/images/chakan.gif" alt="详情" width="16" height="18" border="0" /></a>&nbsp;
			</jysz:permission>
				<s:if test="@com.jysz.certificate.persistence.enums.WorkflowState@SUBMITED.equals(state) ">
				<jysz:permission code="CM_WF_AUDIT">
					<a href="javascript:audit(<s:property value="getFirstObjId(id)"/>,<s:property value="type.index"/>);"><img src="${contextPath}/images/audit.png" alt="审核" border="0" /></a>
				</jysz:permission>
				</s:if>
			</td>
		</tr>
	</s:iterator>
	<tr> 
	 <td height="36" colspan="10" class="down-center-td-width-bg" align="right">
			<%@ include file="/WEB-INF/view/common/pagination.jsp"%>
 		</td>
	</tr>
</table>

<br/><br/><br/><br/><br/>
<div align="center"><jsp:include page="/include/footer.inc"></jsp:include></div>
</body>
</html>

